/*src/models/CategorySign
 * 版权：Copyright (c) 2018 红网
 * 
 * 创建日期：Monday October 25th 2018
 * 创建者：胡燕龙(huyl) - y.dragon.hu@hotmail.com
 * 
 * 修改日期: Monday, 15th October 2018 4:08:28 pm
 * 修改者: 胡燕龙(huyl) - y.dragon.hu@hotmail.com
 * 
 * 说明
 * 		1、Mock 测试数据
 */
// import { mock } from "mockjs";
import { startMock } from "pao-aop-client";
import { mock } from "mockjs";
import { delete_catagory, select_catagory, get_category, get_single_list_for_category, get_single_count_for_category } from './category-mock';
import { get_external_link_list, delete_extern_link, get_external_link } from "./extern-link-mock";

const dev = process.env.NODE_ENV === 'development';

if (dev) {
    startMock('http://localhost:3010/remoteCall', (serviceName, functionName, args) => {
        // 产品相关服务 
        if (serviceName === 'IProductTypeService') {
            switch (functionName) {
                case 'get_product_type_list': return get_product_type_list();
                default: return null;
            }
        }
        // 品类相关服务
        if (serviceName === 'ICategoryTemplateSignService') {
            switch (functionName) {
                case 'get_category_list': return select_catagory(args[0], 1, 2);
                case 'delete_category': return delete_catagory(args);
                case 'get_category': return get_category(args[0]);
                case 'get_single_list': return get_single_list_for_category(args[0], args[0], args[0]);
                case 'get_single_count': return get_single_count_for_category(args);
                default: return null;
            }
        }
        // 外链相关服务
        if (serviceName === 'IExternalLinkSignService') {
            switch (functionName) {
                case 'get_external_link_list': return get_external_link_list(args[0], 1, 2);
                case 'delete': return delete_extern_link(args);
                case 'insert': return delete_catagory(args);
                case 'get_external_link': return get_external_link(args[0]);
                default: return null;
            }
        }
        if (serviceName === 'IAnalysisStatisticsService') {
            switch (functionName) {
                case 'AnalysStatistics': return AnalysStatistics();
                case 'line_data': return line_data();
                // case 'category_model_line_data': return category_model_line_data();
                // case 'single_product_model_line_data': return single_product_model_line_data();
                // case 'external_links_model_line_data': return external_links_model_line_data();
                case 'total_analysis_bar': return line_data();
                default: return null;
            }
        }
        if (serviceName === 'ISingleProductSignService') {
            switch (functionName) {
                case 'get_single_list': return get_single_list();
                case 'get_single': return get_single();
                case 'get_category_list': return get_category_list();
                case 'delete': return delete_Single_Product_Sign();
                case 'insert': return insert_Single_Product_Sign();
                default: return null;
            }
        }
        // 权限服务接口
        if (serviceName === 'IPermissionService') {
            switch (functionName) {
                case 'get_permission_list': return getPermissionList();
                case 'get_role_list': return getRoleList();
                case 'is_permission': return isPermission();
                default: return null;
            }
        }
        // 模版管理服务接口
        if (serviceName === 'IStencilService') {
            switch (functionName) {
                case 'get_stencil_list': return getStencilList();
                case 'get_stencil': return getStencil();
                default: return null;
            }
        }
    });
}
function getStencilList() {
    let this_data: any[] = [];
    this_data = [{
        id: '1',
        stencil_name: '第一个模版',
        stencil_value: [
            {
                format: 1,
                label: "保养常识",
                value: ""
            }, {
                format: 1,
                label: "保养常识2",
                value: ""
            }
        ],
        create_date: '2019-4-30'
    }, {
        id: '2',
        stencil_name: '第二个模版',
        stencil_value: [
            {
                format: 1,
                label: "这是什么",
                value: ""
            }, {
                format: 1,
                label: "那是什么",
                value: ""
            }
        ],
        create_date: '2019-4-30'
    }];
    let data: any = {
        result: this_data,
        total: 2
    };
    return mock({ result: data });
}
function getStencil() {
    let data: any = {
        id: '2',
        stencil_name: '第二个模版',
        stencil_value: [
            {
                format: 1,
                label: "这是什么",
                value: ""
            }, {
                format: 1,
                label: "那是什么",
                value: ""
            }
        ],
        create_date: '2019-4-30'
    };
    return mock({ result: data });
}

function getPermissionList() {

}
function getRoleList() {

}
function isPermission() {

}
// function select(info: CategorySign, page_num: number, size: number) {}

function AnalysStatistics() {
    let this_data: any[] = [];
    this_data = [{
        id: '1',
        name: '佛山市xx有限公司',
        handle_name: 'asfd34',
        count: 32
    }, {
        id: '2',
        name: '佛山市xx有限公司',
        handle_name: 'KKd34',
        count: 87
    }, {
        id: '3',
        name: '佛山市xx有限公司',
        handle_name: 'NFSd34',
        count: 55
    }, {
        id: '4',
        name: '佛山市xx有限公司',
        handle_name: 'NFSd34',
        count: 55
    }, {
        id: '5',
        name: '佛山市xx有限公司',
        handle_name: 'NFSd34',
        count: 55
    }, {
        id: '6',
        name: '佛山市xx有限公司',
        handle_name: 'NFSd34',
        count: 55
    }, {
        id: '7',
        name: '佛山市xx有限公司',
        handle_name: 'NFSd34',
        count: 55
    }, {
        id: '8',
        name: '佛山市xx有限公司',
        handle_name: 'NFSd34',
        count: 55
    }, {
        id: '9',
        name: '佛山市xx有限公司',
        handle_name: 'NFSd34',
        count: 55
    }, {
        id: '10',
        name: '佛山市xx有限公司',
        handle_name: 'NFSd34',
        count: 55
    }];
    return mock({ result: this_data });
}
function line_data() {
    let this_data: any[] = [
        { count: 412, date: "一月" },
        { count: 410, date: "二月" },
        { count: 200, date: "三月" },
        { count: 589, date: "四月" },
        { count: 364, date: "五月" },
        { count: 623, date: "六月" },
        { count: 491, date: "七月" },
        { count: 382, date: "八月" },
        { count: 399, date: "九月" },
        { count: 375, date: "十月" },
        { count: 413, date: "十一月" },
        { count: 458, date: "十二月" }
    ];
    let data: any = {
        result: this_data,
        msg_code: '0',
        model_total: '229',
        model_month_add: '60'
    };
    return mock({ result: data });
}
function get_single_list() {
    let this_data: any[] = [{
        id: '1',
        handle_code: '345',
        handle_name: '面粉1',
        handle_type: '食品',
        user_id: '222',
        rc_code: 'sadas',
        create_date: '20190318',
        modify_date: '20190317',
        product_type: '1',
        custom_attribute: [],
        product_picture: 'd',
        company_handle_name: '行星系',
        company_handle_code: '8829',
        category_handle_name: '什么鬼',
        category_handle_code: 'cc',
    }, {
        id: '2',
        handle_code: '345',
        handle_name: '面粉1',
        handle_type: '食品',
        user_id: '222',
        rc_code: 'sadas',
        create_date: '20190318',
        modify_date: '20190317',
        product_type: '2',
        custom_attribute: [],
        product_picture: 'd',
        company_handle_name: '行星系',
        company_handle_code: '8829',
        category_handle_name: '什么鬼',
        category_handle_code: 'cc',
    }, {
        id: '3',
        handle_code: '345',
        handle_name: '面粉1',
        handle_type: '食品',
        user_id: '222',
        rc_code: 'sadas',
        create_date: '20190318',
        modify_date: '20190317',
        product_type: '4',
        custom_attribute: [],
        product_picture: 'd',
        company_handle_name: '行星系',
        company_handle_code: '8829',
        category_handle_name: '什么鬼',
        category_handle_code: 'cc',
    }];
    let data: any = {
        result: this_data,
        number: 3,
        msg_code: '0',
    };
    return mock({ result: data });
}
function get_single() {
    let this_data: any = {
        id: '3',
        handle_code: '88.168.88/ccccc',
        handle_name: '面粉',
        handle_type: '食品',
        user_id: '222',
        rc_code: 'sadas',
        create_date: '20190318',
        modify_date: '20190317',
        product_type: '1',
        custom_attribute: [
            {
                label: '类目011',
                value: ['https://gss0.bdstatic.com/94o3dSag_xI4khGkpoWK1HF6hhy/baike/w%3D268%3Bg%3D0/sign=b819d1234034970a47731729adf1b6f5/21a4462309f7905288e85e320df3d7ca7acbd5c2.jpg'],
                format: 3
            },
            {
                label: '类目023',
                value: ['https://gss0.bdstatic.com/94o3dSag_xI4khGkpoWK1HF6hhy/baike/w%3D268%3Bg%3D0/sign=b819d1234034970a47731729adf1b6f5/21a4462309f7905288e85e320df3d7ca7acbd5c2.jpg', 'https://gss0.bdstatic.com/94o3dSag_xI4khGkpoWK1HF6hhy/baike/w%3D268%3Bg%3D0/sign=b819d1234034970a47731729adf1b6f5/21a4462309f7905288e85e320df3d7ca7acbd5c2.jpg'],
                format: 3
            }, {
                label: '类目022',
                value: 'xx22222',
                format: 1
            }
        ],
        product_picture: [
            'https://gss0.bdstatic.com/94o3dSag_xI4khGkpoWK1HF6hhy/baike/w%3D268%3Bg%3D0/sign=b819d1234034970a47731729adf1b6f5/21a4462309f7905288e85e320df3d7ca7acbd5c2.jpg',
            'https://gss0.bdstatic.com/94o3dSag_xI4khGkpoWK1HF6hhy/baike/w%3D268%3Bg%3D0/sign=b819d1234034970a47731729adf1b6f5/21a4462309f7905288e85e320df3d7ca7acbd5c2.jpg'
        ],
        company_handle_name: '行星系',
        company_handle_code: '8829',
        category_handle_name: '什么鬼',
        category_handle_code: 'cc',
    };
    return mock({ result: this_data });
}
function get_category_list() {
    let this_data: any = [{
        id: '1',
        handle_code: '345',
        handle_name: '面粉1',
        handle_type: '食品',
        user_id: '222',
        rc_code: 'sadas',
        create_date: '20190318',
        modify_date: '20190317',
        product_type: '3',
        custom_attribute: [],
        product_picture: 'd',
        company_handle_name: '行星系',
        company_handle_code: '8829',
        category_picture: [
            'https://gss0.bdstatic.com/94o3dSag_xI4khGkpoWK1HF6hhy/baike/w%3D268%3Bg%3D0/sign=b819d1234034970a47731729adf1b6f5/21a4462309f7905288e85e320df3d7ca7acbd5c2.jpg',
            'https://gss0.bdstatic.com/94o3dSag_xI4khGkpoWK1HF6hhy/baike/w%3D268%3Bg%3D0/sign=b819d1234034970a47731729adf1b6f5/21a4462309f7905288e85e320df3d7ca7acbd5c2.jpg'
        ]
    }, {
        id: '2',
        handle_code: '12',
        handle_name: '面粉1',
        handle_type: '食品',
        user_id: '222',
        rc_code: 'sadas',
        create_date: '20190318',
        modify_date: '20190317',
        product_type: '1',
        custom_attribute: [],
        product_picture: 'd',
        company_handle_name: '行星系',
        company_handle_code: '8829',
        category_picture: [
            'https://gss0.bdstatic.com/94o3dSag_xI4khGkpoWK1HF6hhy/baike/w%3D268%3Bg%3D0/sign=b819d1234034970a47731729adf1b6f5/21a4462309f7905288e85e320df3d7ca7acbd5c2.jpg',
            'https://gss0.bdstatic.com/94o3dSag_xI4khGkpoWK1HF6hhy/baike/w%3D268%3Bg%3D0/sign=b819d1234034970a47731729adf1b6f5/21a4462309f7905288e85e320df3d7ca7acbd5c2.jpg'
        ]
    }, {
        id: '3',
        handle_code: '66',
        handle_name: '面粉1',
        handle_type: '食品',
        user_id: '222',
        rc_code: 'sadas',
        create_date: '20190318',
        modify_date: '20190317',
        product_type: '1',
        custom_attribute: [],
        product_picture: 'd',
        company_handle_name: '行星系',
        company_handle_code: '8829',
        category_picture: [
            'https://gss0.bdstatic.com/94o3dSag_xI4khGkpoWK1HF6hhy/baike/w%3D268%3Bg%3D0/sign=b819d1234034970a47731729adf1b6f5/21a4462309f7905288e85e320df3d7ca7acbd5c2.jpg',
            'https://gss0.bdstatic.com/94o3dSag_xI4khGkpoWK1HF6hhy/baike/w%3D268%3Bg%3D0/sign=b819d1234034970a47731729adf1b6f5/21a4462309f7905288e85e320df3d7ca7acbd5c2.jpg'
        ]
    }];
    let data: any = {
        result: this_data,
        number: 3,
        msg_code: '0'
    };
    return mock({ result: data });
}
function delete_Single_Product_Sign() {
    let data: any = true;
    return mock({ result: data });
}
function insert_Single_Product_Sign() {
    let data: any = true;
    return mock({ result: data });
}
function get_product_type_list() {
    let this_data: any = [{
        id: '1',
        product_type_name: '食品',
        parent_id: ''
    }, {
        id: '2',
        product_type_name: '厨房用品',
        parent_id: ''
    }, {
        id: '3',
        product_type_name: '汽车',
        parent_id: ''
    }];
    let data: any = {
        result: this_data,
        number: 3,
    };
    return mock({ result: data });
}